# 第一题
name = {'1001': 'zhangsan', '1002': 'lisi', '1005': 'tom', '1008': 'jerry'}
score = [['1005', 98], ['1009', 102], ['1002', 85], ['1001', 98], ['1007', 120]]
scored = dict(score)

foo = (lambda namedict, scorelist: ('id为{}的用户{}的分数是{}'.format(key, namedict[key], scorelist[key]) for key in namedict.keys() if key in scorelist))
for i in foo(name, scored):
    print(i)
# def a(namedict, scorelist):
#     for key in namedict:
#         if key in scorelist.keys():
#             yield 'id为{}的用户{}的分数是{}'.format(key, namedict[key], scorelist[key])

# 没有分数的用户记得输出0

# 第二题


def reverse(data: str):
    datalst = []
    start = 0
    for i, x in enumerate(data):
        if x in ' ,.?:;!':
            datalst.append(data[start:i])
            start = i+1
            datalst.append(x)

    print(datalst)
    return ''.join(datalst[-1::-1])


print(reverse('i am tom, i\'m 20 years.'))

# 第二题完成的很棒。